﻿//7. Write a method that reverses the digits of given decimal number. Example: 256  652


using System;
using System.Collections.Generic;

class ReversesANumbersDigits
{
    static void Main()
    {
        decimal number = decimal.Parse(Console.ReadLine());
        Console.WriteLine(ReversesNumber(number));
    }
    static decimal ReversesNumber(decimal number)
    {
        string stringNumber = Convert.ToString(number);
        char[] digits = stringNumber.ToCharArray();
        int startDigit = 0;
        if (digits[0] == '-')
        {
            startDigit = 1;
        }
        char tempNum;
        int counter = 0;
        for (int i = startDigit; i < digits.Length / 2; i++)
        {
            tempNum = digits[i];
            digits[i] = digits[digits.Length - 1 + counter];
            digits[digits.Length - 1] = tempNum;
            counter++;
        }
        stringNumber = new String(digits);
        decimal reverseNumber = decimal.Parse(stringNumber);
        return reverseNumber;
    }
}
